classes_lib = {
    Observer: function(callback) {
        this.observers = [];
        this.callbak = callback;
        this.fire = function(response) {
            for (var k in this.observers) {
                this.observers[k][callback].call(this.observers[k], response);
            }
        };
        this.add = function(ev, force) {
            this.observers.push(ev);
            if (force) ev[callback]();
        };
    },
    CssTemplate: function(id, url) {
        this.id = id;
        this.url = url;

        this.exist = function() {
            return this.id && !!document.getElementById(this.id);
        };

        this.remove = function() {
            if (this.id) system_lib.removeStyle(this.id);
        };

        this.add = function(css) {
            css = css.replace(/\[base_url\]/gi, system_lib.baseUrl + ((this.url)? this.url: '') );

            if (this.exist())
                document.getElementById(this.id).textContent = css;
            else
              system_lib.addStyle(css, this.id);
        };
    }
}